home *** CD-ROM | disk | FTP | other *** search
- diff -c ./readline.c /home/scott/work/st-bash-1.10/lib/readline/readline.c
- *** ./readline.c Thu Oct 3 16:19:58 1991
- --- /home/scott/work/st-bash-1.10/lib/readline/readline.c Sun Oct 27 22:55:24 1991
- ***************
- *** 30,35 ****
- --- 30,44 ----
- static char *xmalloc (), *xrealloc ();
- #endif /* STATIC_MALLOC */
-
- + /**
- + ** (sjk)++ On an Atari we need these for the xconsole routines and the
- + ** definitions of the scan codes for the extended keyboard.
- + **/
- + #if defined(atarist)
- + #include <osbind.h>
- + #include <keycodes.h>
- + #endif
- +
- #include <stdio.h>
- #include <sys/types.h>
- #include <fcntl.h>
- ***************
- *** 48,55 ****
- # include <unistd.h>
- #endif
-
- ! #define NEW_TTY_DRIVER
- ! #define HAVE_BSD_SIGNALS
- /* #define USE_XON_XOFF */
-
- /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
- --- 57,64 ----
- # include <unistd.h>
- #endif
-
- ! #define NEW_TTY_DRIVER
- ! /* #define HAVE_BSD_SIGNALS */
- /* #define USE_XON_XOFF */
-
- /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
- ***************
- *** 85,90 ****
- --- 94,107 ----
- #include <sgtty.h>
- #endif
-
- + /**
- + ** (sjk)++ sgtty.h defines META on the Atari ST, so we must undefine it so we
- + ** get the proper definition of the META macro from readline.h
- + **/
- + #if defined(atarist)
- + #undef META
- + #endif
- +
- #include <errno.h>
- extern int errno;
-
- ***************
- *** 186,191 ****
- --- 203,209 ----
- #define HANDLE_SIGNALS
-
-
- +
- /* **************************************************************** */
- /* */
- /* Line editing input utility */
- ***************
- *** 307,312 ****
- --- 325,350 ----
-
- static void rl_prep_terminal (), rl_deprep_terminal ();
-
- +
- + /**
- + ** (sjk)++ To get the keyboard mapping right we use the I/O routines
- + ** from xconsole.c in the termcap library. Here we initialize
- + ** a few of the more common keys.
- + **/
- + #if defined(atarist)
- + void initialize_st_bindings()
- + {
- + console_set_key(CURS_UP,"\020" , (char *)0, (char *)0);
- + console_set_key(CURS_DN,"\016" , (char *)0, (char *)0);
- + console_set_key(CURS_LF,"\002" , (char *)0, (char *)0);
- + console_set_key(CURS_RT,"\006" , (char *)0, (char *)0);
- + console_set_key(K_UNDO, "logout ", "logout
- ", (char *)0);
- + console_set_key(K_HELP, "help " , "help
- ", (char *)0);
- + console_set_key(K_INS, "\t", "echo -en \"\\033E\\\033e
- \" ", (char *)0);
- + console_set_key(0x2d,"x","X","\033x");
- + }
- + #endif
- +
- /* Read a line of input. Prompt with PROMPT. A NULL PROMPT means
- none. A return value of NULL means that EOF was encountered. */
- char *
- ***************
- *** 547,553 ****
- --- 585,598 ----
- }
- #else
- #if defined (HAVE_BSD_SIGNALS)
- +
- + /**
- + ** (sjk)++ Quitely Ignored on the Atari ST (for now!)
- + **/
- + #if !defined(atarist)
- sigsetmask (0);
- + #endif
- +
- #endif /* HAVE_BSD_SIGNALS */
- #endif /* HAVE_POSIX_SIGNALS */
-
- ***************
- *** 703,708 ****
- --- 748,758 ----
- long chars_avail;
- char input;
-
- + /**
- + ** (sjk)++ For the Atari ST, we use the xconsole routines from termcap
- + ** to do all the console I/O. (thanx Jwahar!)
- + **/
- + #if !defined(atarist)
- #if defined (FIONREAD)
- result = ioctl (tty, FIONREAD, &chars_avail);
- #endif
- ***************
- *** 720,729 ****
- if (chars_avail == -1 && errno == EAGAIN)
- return;
- }
-
- /* If there's nothing available, don't waste time trying to read
- something. */
- ! if (chars_avail == 0)
- return;
-
- tem = ibuffer_space ();
- --- 770,790 ----
- if (chars_avail == -1 && errno == EAGAIN)
- return;
- }
- + #endif
- + #if defined(atarist)
- + if (console_input_status(tty) == 0) /* tty = fileno(input) */
- + { chars_avail = -1;
- + return;
- + }
- + else
- + { chars_avail = 1;
- + input = (char)console_read_byte(tty); /* tty = fileno(input) */
- + }
- + #endif
-
- /* If there's nothing available, don't waste time trying to read
- something. */
- ! if (chars_avail < 1)
- return;
-
- tem = ibuffer_space ();
- ***************
- *** 1062,1067 ****
- --- 1123,1135 ----
- {
- extern char *rl_display_prompt;
-
- + /**
- + ** (sjk)++ This is where the Atari ST key bindings are really initialized.
- + **/
- + #if defined(atarist)
- + initialize_st_bindings();
- + #endif
- +
- /* If we have never been called before, initialize the
- terminal and data structures. */
- if (!rl_initialized)
- ***************
- *** 1782,1788 ****
- putc (data[i], out_stream);
- #else
- for (i = last_c_pos; i < new; i++)
- ! putc (data[i], out_stream);
- #endif /* HACK_TERMCAP_MOTION */
- }
- else
- --- 1850,1856 ----
- putc (data[i], out_stream);
- #else
- for (i = last_c_pos; i < new; i++)
- ! putc (data[i], out_stream);
- #endif /* HACK_TERMCAP_MOTION */
- }
- else
- ***************
- *** 2156,2162 ****
-
- for (i = 0; i < count; i++)
- putc (' ', out_stream);
- -
- backspace (count);
- }
- }
- --- 2224,2229 ----
- ***************
- *** 2202,2208 ****
- --- 2269,2280 ----
- if (terminal_prepped)
- return;
-
- + /**
- + ** (sjk)++ Used to be in a #ifdef HAVE_BSD_SIGNALS (v1.08 and under)
- + **/
- + #if !defined(atarist)
- oldmask = sigblock (sigmask (SIGINT));
- + #endif
-
- /* We always get the latest tty values. Maybe stty changed them. */
- ioctl (tty, TIOCGETP, &the_ttybuff);
- ***************
- *** 2217,2224 ****
- #if !defined (ANYP)
- # define ANYP (EVENP | ODDP)
- #endif
- !
- ! /* If this terminal doesn't care how the 8th bit is used,
- then we can use it for the meta-key. We check by seeing
- if BOTH odd and even parity are allowed. */
- if (the_ttybuff.sg_flags & ANYP)
- --- 2289,2305 ----
- #if !defined (ANYP)
- # define ANYP (EVENP | ODDP)
- #endif
- !
- ! /**
- ! ** (sjk)++ On the Atari ST we set the terminal to (RAW || PASS8) mode
- ! ** to give 8bit Meta Key support.
- ! **/
- ! #if defined(atarist)
- ! the_ttybuff.sg_flags |= (RAW || PASS8);
- ! #define LPASS8 PASS8
- ! #endif
- !
- ! /* If this terminal doesn't care how the 8th bit is used,
- then we can use it for the meta-key. We check by seeing
- if BOTH odd and even parity are allowed. */
- if (the_ttybuff.sg_flags & ANYP)
- ***************
- *** 2287,2293 ****
- #endif /* TIOCGLTC */
-
- the_ttybuff.sg_flags &= ~(ECHO | CRMOD);
- ! the_ttybuff.sg_flags |= CBREAK;
- ioctl (tty, TIOCSETN, &the_ttybuff);
-
- terminal_prepped = 1;
- --- 2368,2383 ----
- #endif /* TIOCGLTC */
-
- the_ttybuff.sg_flags &= ~(ECHO | CRMOD);
- !
- ! /**
- ! ** (sjk)++ Atari ST always should be in RAW mode
- ! **/
- ! #if !defined(atarist)
- ! the_ttybuff.sg_flags |= CBREAK;
- ! #else
- ! the_ttybuff.sg_flags |= RAW;
- ! #endif
- !
- ioctl (tty, TIOCSETN, &the_ttybuff);
-
- terminal_prepped = 1;
- ***************
- *** 2309,2315 ****
- --- 2399,2410 ----
- if (!terminal_prepped)
- return;
-
- + /**
- + ** (sjk)++ Used to be in a #ifdef HAVE_BSD_SIGNALS (v1.08 and under)
- + **/
- + #if !defined(atarist)
- oldmask = sigblock (sigmask (SIGINT));
- + #endif
-
- the_ttybuff.sg_flags = original_tty_flags;
- ioctl (tty, TIOCSETN, &the_ttybuff);
- ***************
- *** 3852,3858 ****
- temp = matches[l];
- else
- temp++;
- -
- fprintf (out_stream, "%s", temp);
- for (k = 0; k < max - strlen (temp); k++)
- putc (' ', out_stream);
- --- 3947,3952 ----
- ***************
- *** 5060,5065 ****
- --- 5154,5167 ----
- {
- char *temp;
-
- + /**
- + ** (sjk)++ We need to alway close, then reopen the directory just
- + ** incase some external command wrote a Auto Symbolic link
- + ** that invalidates the symdir cache.
- + **/
- + #if defined(atarist)
- + _del_symdir_cache();
- + #endif
- if (dirname) free (dirname);
- if (filename) free (filename);
- if (users_dirname) free (users_dirname);
- ***************
- *** 5097,5103 ****
-
- rl_filename_completion_desired = 1;
- }
- !
- /* At this point we should entertain the possibility of hacking wildcarded
- filenames, like /usr/man/man<WILD>/te<TAB>. If the directory name
- contains globbing characters, then build an array of directories to
- --- 5199,5205 ----
-
- rl_filename_completion_desired = 1;
- }
- !
- /* At this point we should entertain the possibility of hacking wildcarded
- filenames, like /usr/man/man<WILD>/te<TAB>. If the directory name
- contains globbing characters, then build an array of directories to
- ***************
- *** 6230,6236 ****
- {
- int result;
- unsigned char c;
- !
- while (1)
- {
- result = read (fileno (stream), &c, sizeof (char));
- --- 6332,6342 ----
- {
- int result;
- unsigned char c;
- ! /**
- ! ** (sjk)++ We again use the termcap xconsole routines to do input
- ! ** from the console.
- ! **/
- ! #if !defined(atarist)
- while (1)
- {
- result = read (fileno (stream), &c, sizeof (char));
- ***************
- *** 6249,6254 ****
- --- 6355,6363 ----
- if (errno != EINTR)
- return (EOF);
- }
- + #else
- + c = 0xff & console_read_byte(fileno(stream));
- + #endif
- }
-
- #if defined (STATIC_MALLOC)
-